package com.springbootes.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @User 小菜鸡
 * @Data 2020/5/16
 */
@Configuration
public class ElasticSearchClientConfig {

    @Bean//注意，默认的bean的name就是方法名restHighLevelClient
    public RestHighLevelClient restHighLevelClient(){
        return new RestHighLevelClient(
                RestClient.builder(new HttpHost("127.0.0.1",9200,"http"))
        );
    }
}
